# Contributor: Gennady Feldman <gena01@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=consul-replicate
pkgver=0.4.0
pkgrel=26
pkgdesc="Consul cross-DC KV replication daemon"
url="https://www.consul.io/"
arch="all"
license="MPL-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/consul-replicate/archive/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
export GO111MODULE=off

build() {
	mkdir -p "$builddir/src/github.com/hashicorp"
	ln -sf "$builddir" "$builddir/src/github.com/hashicorp/$pkgname"
	cd "$builddir/src/github.com/hashicorp/$pkgname"

	GOPATH="$builddir" go build -v -o bin/$pkgname
}

package() {
	# Main binary
	install -m750 -D bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
960f8a54890932663d832247e2f9eec536a6e4f21e3e1f602399e9465cbb355eb2e4dcbc198bd2362442088c1912664b0640b59ce099c988508f4715b73fbcd7  consul-replicate-0.4.0.tar.gz
"
